import java.awt.Color;
import java.awt.Font;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.Random;

import ij.IJ;
import ij.ImagePlus;
import ij.gui.NewImage;
import ij.plugin.PlugIn;
import ij.process.ImageProcessor;

// On fournit deux images (meme taille), on fabrique un masque et les deux images transformees

public class station2 extends ImagePlus implements PlugIn{
	
	//private ImageProcessor primeIP; 
	private int X=1024,Y=768; // image size
	
	private ImagePlus maskAlpha;  
	private ImageProcessor maskAlphaIP;  

	
	private Random generator=new Random(12104); 
	
	public void run(String arg) {
		System.out.println("go");
		
		
 			ImagePlus laListe[]=new ImagePlus[65];
 			ImageProcessor lesProcs[]=new ImageProcessor[65]; 
 			
 			 File dir = new File("E:/gare");
 		    File[] list = dir.listFiles();
 		    for (int i=0;i<64;i++) {
 		    	System.out.println(i); 
 		    	laListe[i]=IJ.openImage(list[i].toString()) ;
 		    	lesProcs[i]=laListe[i].getProcessor();
 		    }
 		  
	ImagePlus image1=NewImage.createRGBImage ("Image1",X,Y, 1, NewImage.FILL_WHITE);
	ImageProcessor i1=image1.getProcessor();
	
				for(int i=0;i<X;i++){
						for(int j=0;j<Y;j++){
							i1.putPixel(i,j, lesProcs[generator.nextInt(64)].getPixel(i,j)); 
			
		}// y
     }//x
	image1.show();
}
	

}